/*
 * @Author: whq
 * @Date: 2025-08-06 09:46:46
 * @LastEditTime: 2025-08-06 10:16:13
 * @LastEditors: whq
 * @Description:
 * @FilePath: /app/src/api/system/chat.ts
 */
import { RoleCard } from "@/types/cards";
import request from "@/utils/request";

const ROLE_BASE_URL = "/role";

const RoleAPI = {
  /** 查询关联的角色卡 */
  async getBoundRolesList(queryParams?: RoleListQuery) {
    let res = await request<PageResult<RoleCard[]>>({
      url: `${ROLE_BASE_URL}/get_bound_roles`,
      method: "POST",
      data: queryParams,
    });
    return res;
  },
  /** 关联角色卡 */
  async setBind(queryParams?: any) {
    let res = await request<PageResult<RoleCard[]>>({
      url: `${ROLE_BASE_URL}/bind`,
      method: "POST",
      data: queryParams,
    });
    return res;
  },
  /** 删除关联的角色卡 */
  async deleteBind(queryParams?: any) {
    let res = await request<PageResult<RoleCard[]>>({
      url: `${ROLE_BASE_URL}/delete_user_role`,
      method: "POST",
      data: queryParams,
    });
    return res;
  },
};

export default RoleAPI;

/** 角色查询参数 */
export interface RoleListQuery {
  /** 用户唯一标识 */
  token?: string;
  /** 从第N条开始 */
  start?: string;
  /** 每页条数 */
  size?: string;
}

/** 角色查询参数 */
export interface RolePageQuery {
  /** 用户唯一标识 */
  token?: string;
  /** 作者唯一标识 */
  authorToken?: string;
}
